﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using DataAccess;
using Common;

namespace BusinessLogic
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "UserWCF" in code, svc and config file together.
    public class UserWCF : IUserWCF
    {
        public void Register(User u)
        {
            new UserRepository().Register(u);
        }

        public void AllocateRole(User user, Common.Type type)
        {
            new UserRepository().AllocateRole(user, type);
        }

        public Common.Type GetRole(int typeID)
        {
            return new UserRepository().GetRole(typeID);
        }

        public IEnumerable<Common.Country> GetCountries()
        {
            return new UserRepository().GetCountries();
        }

        public bool DoesEmailExist(string email)
        {
            return new UserRepository().DoesEmailExist(email);
        }

        public bool DoesUsernameExist(string username)
        {
            return new UserRepository().DoesEmailExist(username);
        }

        public bool UserAuthentication(string username, string password)
        {
            return new UserRepository().UserAuthentication(username, password);
        }

        public User GetUserByUsername(string username)
        {
            return new UserRepository().GetUserByUsername(username);
        }

        public Common.Type getUserType(int id)
        {
            return new UserRepository().getUserType(id);
        }
    }
}
